#include <stdio.h>  /* -*- c -*- */
#include <stdlib.h>
#include <assert.h>

#cpu x86

typedef int (*pifi)(int);
pifi multiplyCompile(int multiplyValue)
{
  insn *code= (insn *)calloc(1024, sizeof (insn));
  printf("Code generation for multiply value %d\n", multiplyValue);
  #[
	.org	code
     	push   %ebp
     	mov    %esp,%ebp
     	mov    0x8(%ebp),%eax
        imul   $(multiplyValue),%eax,%eax
     	pop    %ebp
     	ret    
  ]#;
  iflush (code, hpbcg_asm_pc);
  printf("Code generated\n");
  return (pifi)code;
}

